import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import { chunkSplitPlugin } from 'vite-plugin-chunk-split';
import { visualizer } from "rollup-plugin-visualizer";
import { VitePWA } from 'vite-plugin-pwa';
const pathSrc = path.resolve(__dirname, 'src');
const pathPublic = path.resolve(__dirname, 'public');
// https://vitejs.dev/config/
export default ({ mode }) => {
  return defineConfig({
    build: {
      outDir: './myresume',
    },
    server: {
      host: '0.0.0.0',
      port: 4000,
      hot: true,
      inline: true
    },
    plugins: [
      vue(),
    ],
    resolve: {
      alias: {
        '@': pathSrc,
        '~': pathPublic,
      }
    },
    css: {
      // css预处理器
      preprocessorOptions: {
        less: {
          charset: false,
          additionalData: '@import "@/libs/varibles.less";',
        },
      },
    }
  })
}
